'use strict';
const requireEx=require('yi-require');
const $ = requireEx('yi-schema');
module.exports = {

  query: $.object({
    page: $.object({
      size: $.number().integer().positive().default(10),
      index: $.number().integer().positive().default(1)
    }),
    filter: $.object({
      contentType:$.object({"$regex":$.string().min(2)}),
      filename:$.object({"$regex":$.string().min(2)}),
      length:$.object({
        "$gte":$.number().integer().positive(),
        "$lte":$.number().integer().positive()
      }).description("查找文件大小区间")
    }),
    project: $.object({
      _id: $.number().valid(0,1),
      filename: $.number().valid(0,1),
      contentType: $.number().valid(0,1),
      length: $.number().valid(0,1),
      chunkSize: $.number().valid(0,1),
      uploadDate: $.number().valid(0,1),
      aliases: $.number().valid(0,1),
      metadata: $.number().valid(0,1),
      cnt: $.number().valid(0,1),
      md5: $.number().valid(0,1)
    }).description("返回列选择，值1返回，0不返回,注意：有0属性，其它列均返回，只有1属性，_id总是返回,除了_id,不能同时有0与1"),
    sort: $.object({
      _id:$.number().valid(-1,1),
      length:$.number().valid(-1,1),
      uploadDate:$.number().valid(-1,1),
      lastOn:$.number().valid(-1,1),
      cnt:$.number().valid(-1,1),
      contentType:$.number().valid(-1,1)
    })
  })

};